Use the include directive to centralize common private rules#937
Merged
Conversation
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
|
For clarity when reviewing rules, can we prefix the global variables in some way? like Does this break the ability to run |
Member
Author
We can, yea. I don't know the answer to the second question yet, but it appears that there are some quirks with the path when running tests even though the rules compile from the root of the repository just fine. Edit: fixed the rule compilation in |
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Member
Author
Looks good using a rule with $ yr scan --path-as-namespace --profiling -w -r rules/anti-static/macho/footer.yara out/chainguard-dev/malcontent-samples/
high_entropy_trailer out/chainguard-dev/malcontent-samples/macOS/2024.SpectralBlur.DPRK/SpectralBlur-macshare
high_entropy_trailer out/chainguard-dev/malcontent-samples/macOS/2024.Ezuri/libdpt1.so
high_entropy_trailer out/chainguard-dev/malcontent-samples/macOS/2024.Rustdoor/localfile
high_entropy_trailer out/chainguard-dev/malcontent-samples/macOS/2024.BeaverTail/Jami
high_entropy_trailer out/chainguard-dev/malcontent-samples/macOS/2024.LightSpy/dropper
high_entropy_trailer out/chainguard-dev/malcontent-samples/macOS/2024.Previewers/Previewers
high_entropy_trailer out/chainguard-dev/malcontent-samples/macOS/2024.cobaltstrike/EDnFsVAEbP
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
716 file(s) scanned in 4.8s. 7 file(s) matched.
«««««««««««« PROFILING INFORMATION »»»»»»»»»»»»
No profiling information gathered, all rules were very fast. |
egibs
commented
May 20, 2025
include directive to centralize common private rules
eslerm
reviewed
May 20, 2025
eslerm
reviewed
May 20, 2025
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
eslerm
approved these changes
May 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
yara-x0.15.0 introduced theincludedirective in parity with Yara. This PR leverages the directive by storing commonly-used private rules in a centralglobals.yarafile which can then be included in rule files as necessary.This directive inserts the included file's contents in each file but since we namespace by path we can have any number of duplicate rule names without encountering compilation errors.